Skip to content

Conversation

@mulhollandms
Copy link

@mulhollandms mulhollandms commented Aug 21, 2020

Found this while trying to use loaddata. If the database is using a case-sensitive collation, then operations that disable check constraints will fail because the stored procedure 'sp_msforeachtable' can't be found. Changing the case to 'sp_MSforeachtable' resolves the issue.

@mulhollandms mulhollandms marked this pull request as ready for review August 21, 2020 16:31
@MrVhek
Copy link

MrVhek commented Sep 15, 2020

Hello, I'm curious of how you did manage to make it work ? My Azure SQL Database freshly created does not know either "sp_MSforeachtable" or "sp_msforeachtable". Did you add it manually ? Thanks in advance.

@mulhollandms
Copy link
Author

So, from what I found when I first stumbled onto this, it seems there's a discrepancy between Azure SQL and other versions of SQL Server. Since sp_MSforeachtable is an undocumented proc, I don't think it ever got ported into Azure SQL. If you're using Azure SQL, you'll probably have to add it manually.

This thread has some more details: https://stackoverflow.com/questions/46651612/deploy-database-to-azure-sql-fails-sp-msforeachtable-not-found

@MrVhek
Copy link

MrVhek commented Sep 15, 2020

Ok thanks, so you are not using Azure SQL Database. Thanks for your help.

@ramusus
Copy link

ramusus commented Apr 26, 2021

This fix works for us, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants